import express from 'express';
import * as advertiseController from './advertise.controller';
import { fileInterceptor } from './advertise.middleware';
const router = express.Router();
import { validateLoginData, authGuard } from '../auth/auth.middleware';

/**
 * 获取内容
 */
router.get('/advertise/:type', advertiseController.index);

/**
 * 获取内容(按 ID)
 */
router.get('/advertiseById/:postId', advertiseController.advertiseDetail);

/**
 * 创建内容
 */
router.post('/advertise', advertiseController.store);

/**
 * 更新内容
 */
router.patch('/advertise/:postId', advertiseController.update);

/**
 * 删除内容
 */
router.post('/advertiseDestroy', advertiseController.destroy);

/**
 * 修改状态
 */
router.patch('/advertiseStatus', advertiseController.status);

/**
 * 上传文件
 */
router.post('/advertiseFiles', fileInterceptor, advertiseController.uploads);

/**
 * 文件服务
 */
router.get('/advertiseFiles/:fileId/serve', advertiseController.serve);

/**
 * 获取文件 ID
 */
router.post('/getAdvertiseFilesId', advertiseController.getFileName)

/**
 * 导出路由
 */
export default router;
